//-----------------------------------------------------------------------bl-
//--------------------------------------------------------------------------
//-----------------------------------------------------------------------el-

#include "myjdr/personnage.hpp"
#include <cmath>

namespace Myjdr
{
  Personnage::Personnage():
     _force(5),
     _endurance(5),
     _psyche(5),
     _mana(5),
     _agilite(5),
     _concentration(5),
     _vitesse(5),
     _max_value(100)
  {
     return;
  }

  Personnage::~Personnage()
  {
     return;
  }

  void Personnage::add_to_force(unsigned int add)
  {
     _force += add;
  }

  void Personnage::add_to_endurance(unsigned int add)
  {
     _endurance += add;
  }

  void Personnage::add_to_psyche(unsigned int add)
  {
     _force += add;
  }

  void Personnage::add_to_mana(unsigned int add)
  {
     _mana += add;
  }

  void Personnage::add_to_agilite(unsigned int add)
  {
     _agilite += add;
  }

  void Personnage::add_to_concentration(unsigned int add)
  {
     _concentration += add;
  }

  void Personnage::add_to_vitesse(unsigned int add)
  {
     _vitesse += add;
  }

  float Personnage::concentration(float t) const
  {
     return (float)_concentration / (float)_max_value * ( 1. - 1. / ( 1. + std::exp(-(float)_psyche/(float)_max_value * 0.3 * (t - t0) ) )  );
  }

  unsigned int Personnage::concentration() const
  {
     return _concentration;
  }

}
